package moni.anyou.com.view.config;

import android.content.SharedPreferences;
import android.util.Log;

import com.baidubce.services.bos.BosClientConfiguration;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.alibaba.sdk.android.oss.OSSClient;
import org.json.JSONObject;

import moni.anyou.com.view.bean.BaseUserInfo;

public class SysConfig {

//    public final static String HosttUrl="115.29.165.57:8080";
//    public final static String HosttUrl="115.29.165.57:8080";
    public final static String HosttUrl="101.37.172.97";
    //远程服务端地址
    public final static String ServerUrl = "http://"+HosttUrl+"/qianmoserver/mobileserver";

    //文件上传网址
    public final static String UploadUrl = "http://"+HosttUrl+"/qianmofileserver/httpserver";
    //文件下载地
    public final static String FileUrl = "http://qianmo88.oss-cn-shanghai.aliyuncs.com/";
    //文件下载地址
    public final static String PicUrl = "http://qianmo88.oss-cn-shanghai.aliyuncs.com/";
    public final static String UpdateUrl= "http://anyou20170615.bj.bcebos.com/anyou.apk";
    public final static String webUrl = "http://"+HosttUrl+"/qianmoserver";
    public final static int port = 8080;
    public static final String File_DIR = "qianmo";
    public static  boolean isIMLogin = false;
    //
    public static String lastupdatetime = "";
    //
    public static String apkupdatetime = "";
    //uid
    public static String uid = "0";

    public static String userSig="0";

    public static JSONObject dataJson = null;
    //
    public static JSONObject userInfoJson = null;
    //
    public static String token = "";
    //
    public static int VersionId = 0;
    public static SharedPreferences prefs;
    public static String prfsName = "";
    //所有的幼儿园ID列表
    public static String compIDList = "";
    //当前幼儿园ID
    public static String cid = "0";
    //幼儿园名字
    public static String cname = "";
    //
    public static String WeChatAppKey = "";
    public static String WeChatSecret = "";
    public static String QQAppKey = "";
    public static String QQSecret = "";
    public static OSSClient oss = null;



//    private static BaseUserInfo user;
//    /**追加封装*/
//    public static void initUserInfo(String str){
//        user=new Gson().fromJson(str,BaseUserInfo.class);
//
//    }

    public static boolean isLogin(){

        if(SysConfig.prefs!=null) {
           uid=SysConfig.prefs.getString("sUser_id", "0");
           userSig=SysConfig.prefs.getString("userSig", "0");
            Log.d("mytim",uid+"  "+userSig);

            Log.d("mytim","islog->:"+(!"0".equals(uid)+" "+" "+(!"0".equals(userSig))));
           if(!"0".equals(uid)&&!"0".equals(userSig))
           {
               return true;
           }else {
               return false;
           }
        }

        return false;
    }

    public static void  logout(){

    }
//    public static BaseUserInfo getUser(){
//        try {
//            if(user!=null) {
//                return user;
//            }
//
//            String str = SysConfig.prefs.getString("sUserInfoJson", null);
//            if (str != null) {
//                user = new Gson().fromJson(str, BaseUserInfo.class);
//                return user;
//            }
//        } catch (JsonSyntaxException e) {
//            e.printStackTrace();
//        }
//        return null;
//    }

}
